Save Table to Microsoft Excel Example (VBA) 您所在的位置:网站首页 cancel vb Save Table to Microsoft Excel Example (VBA)

Save Table to Microsoft Excel Example (VBA)

2023-04-13 06:42| 来源: 网络整理| 查看: 265

Save Table to Microsoft Excel Example (VBA)

This example shows how to save a BOM table annotation to a Microsoft Excel document.

'--------------------------------------------------------------------------- ' Preconditions: ' 1. Open a drawing of an assembly with a BOM. ' 2. Click the move-table icon in the upper-left corner '    of the BOM table to open the table's PropertyManager page. ' ' Postconditions: Saves the selected BOM to c:\temp\BOMTable.xls. '-------------------------------------------------------------------------- Dim swApp As SldWorks.SldWorks Dim swModDoc As SldWorks.IModelDoc2 Dim swTable As SldWorks.ITableAnnotation  

Option Explicit

Public Sub Main()     Set swApp = Application.SldWorks

    Set swModDoc = swApp.ActiveDoc     Dim swSM As ISelectionMgr     Set swSM = swModDoc.SelectionManager     Set swTable = swSM.GetSelectedObject6(1, -1)     swModDoc.ClearSelection2 (True)

    Dim swSpecTable As IBomTableAnnotation     Set swSpecTable = swTable

    ' Save the selected BOM table to Microsoft Excel, including hidden cells     ' and images     status = swSpecTable.SaveAsExcel("c:\temp\BOMTable.xls", True, True)

End Sub

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有